﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using YuShiManageSystem.COM;
using YuShiManageSystem.UI.Customer;
using YuShiManageSystem.UI.Card;
using YuShiManageSystem.DATA;
using YuShiManageSystem.UI.Manager;
using YuShiManageSystem.UI;

namespace YuShiManageSystem
{
    static class Program
    {
        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        [STAThread]
        static void Main()
        {
           try
			{
               Application.EnableVisualStyles();
               Application.SetCompatibleTextRenderingDefault(false);
               Session session = GetSession();		//初始化Session

               //Start start = new Start();  //启动窗体
               //start.Show();

               session.Store = GetStore(session);	//登录
               if (session.Store == null)
                   return;

               //MainForm mf = new MainForm(session);   //进入主窗体
               //session.MainForm = mf;
               Application.Run(new MakeCard(session));
			} catch (Exception )
			{               
				YSMessage.Error("系统错误！");
			}
		}

        static tb_store GetStore(Session session)
        {
 	        try
			{
				Login login = new Login(session);
				login.ShowDialog();
                
				return login.Store;
			} catch (Exception)
			{
				throw;
			}
        }

        static Session GetSession()
		{
			Session session = new Session();			
			session.DataModel = new DataModel();			
			return session;
		}
    }
}

